<form class="form-inline" action="<?=printUrl('Main','adminSubScore')?>" name="subScore" id="subScore">
<div class="table-responsive">
<table border="1" cellspacing="0" class="table table-hover table-bordered table-condensed">
  <thead>
    <?php if ($timeUnitList): ?>
    <tr>
      <th class="bg-primary text-center" rowspan="3">地区</th>
      <th class="bg-primary text-center" rowspan="3">大区</th>
      <th class="bg-primary text-center" rowspan="3">小区</th>
      <th class="bg-primary text-center" rowspan="3">城市</th>
      <th class="bg-primary text-center" rowspan="3">编码</th>
      <th class="bg-primary text-center" rowspan="3">专营店</th>
      <th class="bg-primary text-center" rowspan="3">专营店类型</th>
      <th class="bg-primary text-center" colspan="<?=6+count($timeUnitList)?>">固定传播基金</th>
    </tr>
    <tr>
      <th class="bg-primary text-center" rowspan="2">年度额度</th>
      <th class="bg-primary text-center" rowspan="2">年度申请总金额</th>
      <th class="bg-primary text-center" rowspan="2">年度审批总金额</th>
      <th class="bg-primary text-center" rowspan="2">年初补贴金额</th>
      <th class="bg-primary text-center" colspan="<?=count($timeUnitList)?>">各双月扣罚金额</th>
      <th class="bg-primary text-center" rowspan="2">扣罚金额总和</th>
      <th class="bg-primary text-center" rowspan="2">实际补贴金额</th>
    </tr>
    <tr>
      <?php foreach ($timeUnitList as $timeK => $timeV): ?>
      <th class="bg-primary text-center"><?=$timeV['year'].'年'.$timeV['name']?></th>
      <?php endforeach ?>
    </tr>
    <?php else: ?>
    <tr>
      <th class="bg-primary text-center" rowspan="2">地区</th>
      <th class="bg-primary text-center" rowspan="2">大区</th>
      <th class="bg-primary text-center" rowspan="2">小区</th>
      <th class="bg-primary text-center" rowspan="2">城市</th>
      <th class="bg-primary text-center" rowspan="2">编码</th>
      <th class="bg-primary text-center" rowspan="2">专营店</th>
      <th class="bg-primary text-center" rowspan="2">专营店类型</th>
      <th class="bg-primary text-center" colspan="6">固定传播基金</th>
    </tr>
    <tr>
      <th class="bg-primary text-center">年度额度</th>
      <th class="bg-primary text-center">年度申请总金额</th>
      <th class="bg-primary text-center">年度审批总金额</th>
      <th class="bg-primary text-center">年初补贴金额</th>
      <th class="bg-primary text-center">扣罚金额总和</th>
      <th class="bg-primary text-center">实际补贴金额</th>
    </tr>
    <?php endif ?>
  </thead>
  <tbody>
    <?php
    $total = getArrayColumnTotal($procList,
        array('yearMoney','applyMoney','auditMoney','preSubsidyMoney','lostTotalMoney','actSubsidyMoney'),1);
    $total['lostMoney'] = array();
    foreach ($procList as $k => $v) {
    ?>
    <tr>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['area'] : ''?></td>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['region'] : ''?></td>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['spsarea'] : ''?></td>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['city'] : ''?></td>
      <td class="text-center"><a href="<?=printUrl('SpreadBudget','adminList', array('storeId'=>$v['storeId']))?>" target="_blank"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['coding'] : ''?></a></td>
      <td class="text-center"><a href="<?=printUrl('SpreadBudget','adminList', array('storeId'=>$v['storeId']))?>" target="_blank"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['storeName'] : ''?></a></td>
      <td class="text-center"><?=$v['storeTypeStr']?>
      </td>
      <td class="text-center"><?=(float)$v['yearMoney']?></td>
      <td class="text-center"><?=(float)$v['applyMoney']?></td>
      <td class="text-center"><?=(float)$v['auditMoney']?></td>
      <td class="text-center"><?=(float)$v['preSubsidyMoney']?></td>
      <?php foreach ($timeUnitList as $timeK => $timeV): ?>
      <td class="text-center">
      <?php
      isset($total['lostMoney'][$timeV['id']]) || $total['lostMoney'][$timeV['id']] = 0;
      if (isset($v['lostMoney'][$timeV['id']])) {
        echo (float)$v['lostMoney'][$timeV['id']]['lostMoney'];
        $total['lostMoney'][$timeV['id']] += $v['lostMoney'][$timeV['id']]['lostMoney'];
      }
      ?></td>
      <?php endforeach ?>
      <td class="text-center"><?=(float)$v['lostTotalMoney']?></td>
      <td class="text-center"><?=(float)$v['actSubsidyMoney']?></td>
    </tr>
    <?php } ?>
    <tr>
      <td class="text-center" colspan="7">合计</td>
      <td class="text-center"><?=$total['yearMoney']?></td>
      <td class="text-center"><?=$total['applyMoney']?></td>
      <td class="text-center"><?=$total['auditMoney']?></td>
      <td class="text-center"><?=$total['preSubsidyMoney']?></td>
      <?php foreach ($timeUnitList as $timeK => $timeV): ?>
      <td class="text-center"><?=$total['lostMoney'][$timeV['id']]?></td>
      <?php endforeach ?>
      <td class="text-center"><?=$total['lostTotalMoney']?></td>
      <td class="text-center"><?=$total['actSubsidyMoney']?></td>
    </tr>
  </tbody>
</table>
</div>
</form>